package person.wend.mybatisexample.plugin.util;

public class ClassUtil {

    public static  <T> Class<? extends T> resolveClass(String alias) {
        try {
            return alias == null ? null : resolveAlias(alias);
        } catch (Exception e) {
            throw new RuntimeException("Error resolving class. Cause: " + e, e);
        }
    }

    public static  <T> Class<T> resolveAlias(String string) {
        try {
            if (string == null) {
                return null;
            }
            Class<T> value;
            value = (Class<T>) Resources.classForName(string);
            return value;
        } catch (ClassNotFoundException e) {
            throw new RuntimeException("Could not resolve type alias '" + string + "'.  Cause: " + e, e);
        }
    }
}
